home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 13
/
CU Amiga Magazine's Super CD-ROM 13 (1997)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1997-08].iso
/
CUCD
/
Graphics
/
irit70
/
bin
/
difftree
< prev
next >
Wrap
Text File
|
1996-05-20
|
1KB
|
56 lines
#!/bin/csh -f
#
# Compares two source trees
#
# Usage: "difftree src-tree dst-tree",
#
# Gershon Elber, Jan 1996.
#
set reverse = 0
if ("$1" == "-r") then
shift
set reverse = 1
endif
if ( $#argv != 2 ) then
echo "Usage: difftree src-tree dst-tree"
exit 1
endif
set src = $1
set dest = $2
if ( ! -e $src ) then
echo "Source directory does not exists"
exit 1
endif
if ( ! -e $dest ) then
echo "Destination directory does not exists"
exit 1
endif
diff -rq $src $dest | awk \
'BEGIN { \
} \
(($1 == "Files") && ($3 == "and") && ($5 == "differ")) { \
if ( $reverse ) { \
printf("echo ===================================\n"); \
printf("echo cp %s %s\n", $2, $4); \
printf("echo ===================================\n"); \
printf("diff %s %s\n", $2, $4); \
} \
else { \
printf("echo ===================================\n"); \
printf("echo cp %s %s\n", $4, $2); \
printf("echo ===================================\n"); \
printf("diff %s %s\n", $4, $2); \
} \
} \
{ \
}' > /tmp/difftree.tmp.$$
csh /tmp/difftree.tmp.$$
rm /tmp/difftree.tmp.$$